using System;
using bitzhuwei.Compiler;

namespace bitzhuwei.ExpFormat {
    partial class CompilerExp {

        public static class reservedWord {
            /// <summary>
            /// +
            /// </summary>
            public const string @Plus符 = "+";
            /// <summary>
            /// -
            /// </summary>
            public const string @Dash符 = "-";
            /// <summary>
            /// *
            /// </summary>
            public const string @Asterisk符 = "*";
            /// <summary>
            /// /
            /// </summary>
            public const string @Slash符 = "/";
            /// <summary>
            /// (
            /// </summary>
            public const string @LeftParenthesis符 = "(";
            /// <summary>
            /// )
            /// </summary>
            public const string @RightParenthesis符 = ")";

        }

        /// <summary>
        /// if <paramref name="token"/> is a reserved word, assign correspond kind and return true.
        /// <para>otherwise, return false.</para>
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        private static bool CheckReservedWord(AnalyzingToken token) {
            bool isReservedWord = true;
            switch (token.value) {
            case reservedWord.@Plus符: token.kind = st.@Plus符; break;
            case reservedWord.@Dash符: token.kind = st.@Dash符; break;
            case reservedWord.@Asterisk符: token.kind = st.@Asterisk符; break;
            case reservedWord.@Slash符: token.kind = st.@Slash符; break;
            case reservedWord.@LeftParenthesis符: token.kind = st.@LeftParenthesis符; break;
            case reservedWord.@RightParenthesis符: token.kind = st.@RightParenthesis符; break;

            default: isReservedWord = false; break;
            }

            return isReservedWord;
        }
    }
}
